#include "fieldinfo.h"
#include "sqlite3.h"

CXFieldInfo::CXFieldInfo(void)
{
	m_strName.clear();
	m_strTypeName.clear();
	m_strDefault.clear();
	m_nType = 0;
	m_nDecimals = 0;
	m_nLength = 0;
	m_nFlag = 0;
}



CXFieldInfo::~CXFieldInfo(void)
{
}


LPCSTR CXFieldInfo::GetName()
{
	return m_strName.c_str();
}

std_method_type_impl(UINT) CXFieldInfo::GetFlag()
{
	return m_nFlag;
}

std_method_type_impl(LPCSTR) CXFieldInfo::GetTypeName()
{
	return m_strTypeName.c_str();
}

std_method_type_impl(int) CXFieldInfo::GetType()
{
	return m_nType;
}


std_method_type_impl(ULONG) CXFieldInfo::GetLength()
{
	return m_nLength;
}


std_method_type_impl(LPCSTR) CXFieldInfo::GetDefault()
{
	return m_strDefault.c_str();
}

std_method_type_impl(UINT) CXFieldInfo::GetDecimals()
{
	return m_nDecimals;
}

std_method_impl CXFieldInfo::SetFlag(UINT nFlag)
{
	m_nFlag = nFlag;
	return S_OK;
}

std_method_impl CXFieldInfo::SetName(LPCSTR lspzName)
{
	rc_assert(lspzName != NULL, E_FAIL)
	m_strName = lspzName;
	return S_OK;
}

std_method_impl CXFieldInfo::SetType(int nType)
{
	m_nType = nType;
	return S_OK;
}


std_method_impl CXFieldInfo::SetTypeName(LPCSTR lpszType)
{
	rc_assert(lpszType != NULL, E_FAIL)
	m_strTypeName = lpszType;
	return S_OK;
}

std_method_impl CXFieldInfo::SetLength(unsigned long nLength)
{
	m_nLength = nLength;
	return S_OK;
}

std_method_impl CXFieldInfo::SetDefault(LPCSTR lpszValue)
{
	rc_assert(lpszValue != NULL, E_FAIL)
	m_strDefault = lpszValue;
	return S_OK;
}

std_method_impl CXFieldInfo::SetDecimals(unsigned int nDecimals)
{
	m_nDecimals = nDecimals;
	return S_OK;
}

HRESULT CXFieldInfo::CreateInstance(IFieldInfo** ppFieldInfo)
{  
	CXFieldInfo* p = ALLOC_NEW CXFieldInfo();
	rc_assert(p != NULL, E_FAIL)
	return p->QueryInterface(IID_IFieldInfo, (void **)ppFieldInfo);
}


